package org.dtrd.modules.organization.entity.bean;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.common.util.DateUtils;
import org.dtrd.modules.organization.entity.po.DtrdEntRdOrganization;

/**
 * <p>
 * 机构表
 * </p>
 *
 * @author QR
 * @since 2021-12-14
 */
@Getter
@Setter
@ApiModel(value = "机构表详情")
public class OrganizationDetail {

    private Integer dataId;

    @ApiModelProperty(value = "机构编码", required = true)
    private String organizationCode;

    @ApiModelProperty(value = "机构名称", required = true)
    private String organizationName;

    @ApiModelProperty("机构图标")
    private String orgIcon;

    @ApiModelProperty("机构缩略图")
    private String orgThumb;

    @ApiModelProperty(value = "机构地区", required = true)
    private String organizationAddress;

    @ApiModelProperty(value = "省", required = true)
    private Integer organizationProvinceId;

    @ApiModelProperty(value = "市", required = true)
    private Integer organizationCityId;

    @ApiModelProperty(value = "区", required = true)
    private Integer organizationAreaId;

    @ApiModelProperty("营业时间_开始")
    private String openingTime;

    @ApiModelProperty("营业时间_结束")
    private String closedTime;

    @ApiModelProperty("机构联系电话")
    private String organizationPhone;

    @ApiModelProperty("机构介绍")
    private String organizationIntroduce;

    @ApiModelProperty(value = "机构等级", required = true)
    private Integer organizationLevel;

    public OrganizationDetail parseFromPo(DtrdEntRdOrganization po) {
        dataId = po.getDataId();
        organizationCode = po.getOrganizationCode();
        organizationName = po.getOrganizationName();
        orgIcon = po.getOrgIcon();
        orgThumb = po.getOrgThumb();
        organizationAddress = po.getOrganizationAddress();
//        openingTime = DateUtils.formatDate(po.getOpeningTime(), DateUtils.short_time_sdf.get().toPattern());
//        closedTime = DateUtils.formatDate(po.getClosedTime(), DateUtils.short_time_sdf.get().toPattern());
        organizationProvinceId = po.getOrganizationProvinceId();
        organizationCityId = po.getOrganizationCityId();
        organizationAreaId = po.getOrganizationAreaId();
        organizationLevel = po.getOrganizationLevel();
        organizationPhone = po.getOrganizationPhone();
        organizationIntroduce = po.getOrganizationIntroduce();
        return this;
    }
}
